package com.qf.service.impl;

import com.qf.dao.GoodsDao;
import com.qf.dao.impl.GoodsDaoImpl;
import com.qf.entity.Goods;
import com.qf.entity.PageBean;
import com.qf.service.GoodsService;

import java.awt.print.Book;
import java.util.List;

/**
 * @author 10202
 * @version V1.0
 * @Project xiaomi
 * @Package com.qf.service.impl
 * @Date 2023/4/14 11:49
 */
public class GoodsServiceImpl implements GoodsService {
    private GoodsDao goodsDao=new GoodsDaoImpl();
    @Override
    public PageBean<Goods> selectGoodsByPage(int pn, int ps, List<Object> params, String where) {

         long size = goodsDao.getCount(where,params);

          List<Goods> goods= goodsDao.getGoods((pn-1)*ps,ps,where,params);
        System.out.println(goods.toString());
        return new PageBean<Goods>(pn,ps,size,goods);
    }

    @Override
    public Goods getGoodsById(String id) {
        return goodsDao.getGoodsById(id);
    }

    @Override
    public void addGoods(Goods goods) {
        goodsDao.addGoods(goods);
    }
}
